package com.yuexun.wiki.controller;
import com.yuexun.wiki.domain.Ebook;
import com.yuexun.wiki.mapper.EbookMapper;
import com.yuexun.wiki.req.EbookReq;
import com.yuexun.wiki.resp.CommonResp;
import com.yuexun.wiki.resp.EbookResp;
import com.yuexun.wiki.service.EbookService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;


@RestController
public class EbookController {
    @Resource
    private EbookService ebookService;
    @GetMapping("/ebook/list")
    public CommonResp list(EbookReq req){
        //把查询结果放到列表中
        CommonResp<List<EbookResp>> resp =new CommonResp<>();
        //创建一个CommonResp类型对象resp
        List<EbookResp> list =ebookService.list(req);
        //将resp对象中的内容设置为查询列表list
        resp.setContent(list);
        //返回resp对象
        return resp;
    }
}
